package org.example.struct.array;

/**
 * @author liyishan
 * @date 2024/2/18 09:11
 * @apiNote
 */

public class Test01614MaxDepth {
    public static void main(String[] args) {
        String s = "1+(2*3)/((2)-1)";
        System.out.println(maxDepth(s));
    }

    public static int maxDepth(String s) {
        int ans = 0,size = 0;
        for(int i =0;i<s.length();i++){
            char ch = s.charAt(i);
            if(ch == '('){
                size++;
                ans = Math.max(ans,size);
            }else if (ch == ')'){
                size--;
            }
        }
        return ans;
    }
}
